package cn.buk.api.ctrip.service;

import cn.buk.api.ctrip.dto.tbooking.*;
import cn.buk.common.JsonResult;
import org.dom4j.Document;

import java.util.Date;
import java.util.List;

/**
 * Created by yfdai on 15/7/25.
 */
public interface TBookingService {
    /**
     * 1. 今日出票单接口
     * @param orderDate
     * @return
     */
    List<TBookingOpenIssueBillInfo> searchOpenIssueOrderList(final String username, final String password, final String md5password, Date orderDate);

    /**
     *  2. 出票单查询(只返回出票单号、出票单状态、政策代码)
     * @param username
     * @param password
     * @param md5password
     * @param searchDate 日期间隔必须在一天内
     * @param issueBillId 默认填写0，需查对应的填写对应的出票单号
     * @return
     */
    List<TBookingIssueBillSearchResult>  searchIssueBill(final String username, final String password, final String md5password, Date searchDate, Long issueBillId);

    /**
     *  3. 出票单详情
     * @param username
     * @param password
     * @param md5password
     * @param issueBillId
     * @return
     */
    TBookingOpenIssueBillInfo getIssueBillInfo(final String username, final String password, final String md5password, final long issueBillId);

    /**
     *  4. 出票单认领、取消认领
     * @param username
     * @param password
     * @param md5password
     * @param issueBillId 出票单ID
     * @param opType 0：取消认领； 1：认领
     * @return
     */
    JsonResult assignIssueBillTo(final String username, final String password, final String md5password, final long issueBillId, final int opType);

    /**
     * 5. 回填票号
     * @param request
     * @return
     */
    JsonResult backFillTicketNo(final String username, final String password, final String md5password, TBookingBackFillTicketNoRequest request);

    /**
     * 6. 已订位待支付订单查询接口
     * @param username
     * @param password
     * @param md5password
     * @return
     */
    List<OrderInfo> searchUnpaidOrders(final String username, final String password, final String md5password);

    /**
     * 7. 修改出票单的PNR
     * @param username
     * @param password
     * @param md5password
     * @return
     */
    JsonResult updateIssueBillPnrNo(final String username, final String password, final String md5password, IssueBillModifyRequest rq);

    /**
     * 8. PNR授权接口
     * @param username
     * @param password
     * @param issueBillId 出票单ID
     * @param pnrNo 需要授权的编码
     * @param officeNo 需要授权的office号
     * @return
     */
    JsonResult getPnrPermission(final String username, final String password, final String md5password, long issueBillId, String pnrNo, String officeNo);

    /**
     * 改签确认接口请求地址
     * @return
     */
    String searchReconfirmTicketList(final String username, final String password, final String md5password);

    List<TBookingOpenIssueBillInfo> processOpenIssueBillResponse(Document document);
    List<TBookingOpenIssueBillInfo> processOpenIssueBillResponse(String xml);

    TBookingOpenIssueBillInfo processIssueBillInfoResponse(Document document);
    TBookingOpenIssueBillInfo processIssueBillInfoResponse(String xml);


    List<TBookingIssueBillSearchResult> processSearchIssueBillResponse(Document document);
    List<TBookingIssueBillSearchResult> processSearchIssueBillResponse(String xml);

    JsonResult processOpenModifyOrderResponse(String xml);
    JsonResult processOpenModifyOrderResponse(Document document);

    /**
     * 处理 出票单认领、取消认领接口 反馈结果
     * @param document
     * @return
     */
    JsonResult processOpenIssueBillAssignResponse(Document document);

    List<OrderInfo> processOpenOrderListResponse(Document document);

    /**
     * 处理 PNR修改接口 返回结果
     * @param document
     * @return
     */
    JsonResult processIssueBillModifyResponse(Document document);


}
